#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int n, maxx = 0;
typedef struct
{
    int s;
    string str;
} node;
vector<node> arr;
node t;
bool cmp(node a, node b)
{
    return a.s < b.s;
}
int main()
{
    cin >> n;
    if (n == 1)
    {
        cin >> t.s >> t.str;
        cout << "NoAccept";
        return 0;
    }
    else
    {
        for (int i = 1; i <= n; i++)
        {
            cin >> t.s >> t.str;
            arr.push_back(t);
            maxx = max(maxx, t.s);
            sort(arr.begin(), arr.end(), cmp);
            t = arr[((int)arr.size() / 2) + 1];
            if (arr.size() % 2 != 0)
            {
                if (maxx != t.s)
                    cout << "Accept[" << t.s << "]: " << t.str << '\n';
                else
                    cout << "NoAccept\n";
            }
        }
    }
}